# -*- coding: utf-8 -*-
import re

def removeNBSP(html, b_web):
	"""
	`b_web` (boolean, optional)
	如果为真，表示是B端的请求，要保留&nbsp，去除<brief>
	app端的需要去除&nbsp，保留<brief>
	"""

	mood = '&nbsp;'
	if b_web == '2':
		mood = '(<brief>.*</brief>)|(<[^>]+>)|(&nbsp;)'
		html = re.sub('<br/?>', '\n', html)
	elif b_web == '1':
		mood = '<brief>.*</brief>'
	html = re.sub(mood, '', html)
	return html
